﻿ {include file="public/header" /}
 <script>
   function check() {
       if($("#where").val() == ''){
           layer.msg("请输入图号或者是图纸名称。。。");
           return false;
       }
       return true;
   }
 </script>
  <body>
    <div class="x-nav">
      <span class="layui-breadcrumb">
        <a href="">首页</a>
        <a href="">订单管理</a>
        <a>
          <cite>订单列表</cite></a>
      </span>
      <a class="layui-btn layui-btn-small" style="line-height:1.6em;margin-top:3px;float:right" href="javascript:location.replace(location.href);" title="刷新">
        <i class="layui-icon" style="line-height:30px">ဂ</i></a>
    </div>
    <div class="x-body">
        <xblock>
          <a class="layui-btn"  target="_blank" href="{:url()}"><i class="iconfont">&#xe718;</i> 框架页面</a>

          <!--<button class="layui-btn layui-btn-danger" onclick="delAll()"><i class="layui-icon"></i>批量删除</button>-->
          <button class="layui-btn" onclick="x_admin_show('添加订单','{:url(\'index/Order/addOrder\')}',600,600)"><i class="layui-icon"></i>添加</button>
          <div class="layui-input-inline">
            <form class="layui-form" action="{:url('index/order/order',['tag'=>'select','if_complete'=>$ifCompletr])}" method="post" onsubmit="return check()">
              <div class="layui-input-inline">
                <input type="text" name="where" id="where" autocomplete="off" placeholder="请输入图号或者是图纸名称..." class="layui-input">
              </div>
              <div class="layui-input-inline">
                <select name="id" lay-search="" >
                  <option value=""></option>

                </select>
              </div>
              <button type="submit" class="layui-btn"  lay-submit="" lay-filter="sreach"><i class="layui-icon">&#xe615;</i></button>
            </form>
          </div>
          <span class="x-right" style="line-height:40px">共条{$count} · 共{$count|getInt}页</span>
        </xblock>
      <div class="layui-row">
        <div class="container-wrap">
          <div class="box-1">
            <table class="layui-table">
              <thead>
              <tr>
                <th>
                  <a  href="{:url('index/order/order',['id'=>$ifCompletr])}" ><button class="layui-btn layui-btn-sm">{$btnText}</button></a>
                </th>
                <th>订单编号</th>
                <th>订单内容</th>
                <th>申请人</th>
                <th>下单时间</th>
                <th>交货日期</th>
                <th>客户简称</th>
                <th>备料</th>
                <th>订单报价</th>
                <th>客户项目号</th>
                <th>完成</th>
                <th>发货</th>
                <th>收款</th>
                <th>评审</th>
                <th>建档时间</th>
                <th>报价</th>
              </tr>
        </thead>
        <tbody>
        {volist name ="orderInfo" id="info"}
          <tr>
            <td class="td-manage">
              <a title="修改" onclick="x_admin_show('修改订单明细','{:url(\'index/Order/editOrder\',[\'id\'=>$info.id])}',600,600)", href="javascript:;"><i style="color: green" class="layui-icon"></i></a>
              <a title="删除" onclick="delete_(this,'{$info.id}')" href="javascript:void(0);" ><i  style="color:red;" class="layui-icon"></i></a>
              <!-- 合同文件 -->
              <a title="合同文件" onclick="x_admin_show('上传合同文件','{:url(\'index/Order/OrderFile\',[\'id\'=>$info.id])}')",
                 href="javascript:;">
                <i style="color: {:widget('Widget/order_files',['id'=>$info.id])}" class="layui-icon">
                  &#xe681;
                </i>
              </a>
            </td>
            <td>  <a title="订单明细" onclick="x_admin_show('<span class=\' layui-bg-blue\'>{$info.order_id}</span> 订单明细','{:url(\'index/Order/orderDetail\',[\'id\'=>$info.id])}')", href="javascript:;"> {$info.order_id} </a></td>
            <td>{$info.order_content}</td>
            <td>{$info.application}</td>
            <td>{$info.order_time}</td>
            <td>{$info.delivery_time}</td>
            <td>{$info.client_id|getClientAbbreviation}</td>
            <td>{$info.prepare}</td>
            <td>{$info.order_price}</td>
            <td>
             {$info.client_prj_id}
            </td>
            <td>
              {if $info.if_complete == 1} 完成 {else/} 未完成 {/if}
            </td>
            <td>
              {if $info.deliver_goods}已发货{else/}未发货{/if}
            </td>
            <td>
              {if $info.receivables == 1} 已收款 {else/} 未收款 {/if}
            </td>
            <td>{$info.review_content}</td>
            <td>{$info.create_time}</td>
            <td onclick="openLinke('{$info.id}')"><a href="#">报价</a></td>
          </tr>
        {/volist}
        </tbody>
      </table>
          </div>
        </div>
      <div class="page">
        {$orderInfo|raw}
      </div>

    </div>
    <script>
        function openLinke(id) {
            layer.open({
                content: '选择你要进入的报价类型～～'
                ,btn: ['产品报价', '定额报价', '总价报价'] //按钮
                ,yes: function(index, layero){
                    //按钮【按钮一】的回调
                    x_admin_show("产品报价","{:url('index/quoted/quotedInfoType1')}?id=" + id);
                },btn2: function(index, layero){
                    //按钮【按钮二】的回调
                    x_admin_show("定额报价","{:url('index/quoted/quotedInfoType2')}?id=" + id);
                },btn3: function(index, layero){
                    //按钮【按钮三】的回调
                    x_admin_show("总价报价","{:url('index/quoted/quotedInfoType3')}?id=" + id);
                }
                ,cancel: function(){
                    //右上角关闭回调
                }
            });
        }

        /*删除*/
        function delete_(obj,id){
            layer.confirm('确认要删除吗？',function(index){
                var url = "{:url('/index/Order/orderDelete')}";
                var postData ={"id":id};
                $.post(url,postData,function (result) {
                    if(result === 1 ){
                        $(obj).parents("tr").remove();
                        layer.msg('已删除!',{icon:1,time:1000});
                    }else {
                        layer.alert("删除失败", {icon: 5});
                    }
                },"json");
            });
        }

    </script>
    </div>
  </body>
</html>